<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Compile Rust to WebAssembly</title>
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  <meta name="apple-touch-fullscreen" content="yes" />
  <meta name="format-detection" content="telephone=no, email=no" />
  <script src="../loader.js"></script>
</head>

<body>
  <h1>Compile Rust to WebAssembly</h1>

  <script>
    loadWebAssembly('./math.wasm')
      .then(instance => {
        const square = instance.exports._square
        console.log('2^2 =', square(2))
        console.log('3^2 =', square(3))
        console.log('(2 + 5)^2 =', square(2 + 5))
      })
  </script>
</body>
</html>
